import Vue from 'vue';
Vue.config.devtools = true;

import Vant from 'vant';
import 'vant/lib/index.css';
import { Toast,ImagePreview } from 'vant';
Toast.setDefaultOptions({ duration: 2000 });

import 'amfe-flexible/index.js'

import App from "./App.vue";
import router from "./router";
import Router from 'vue-router';
import store from "./store";
import './assets/iconfont/iconfont.css';
import './assets/css/reset.css';
import './assets/css/public.css';
import "@/permission";
import "./registerServiceWorker";
import util from "@/assets/js/public";
import maipBridge from "@/assets/js/maipBridge";
import moaBridge_ha_djfupt from "@/assets/js/moaBridge_ha_djfupt";
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import moment from 'moment';
import 'vant/lib/index.less';
import vueFilePreview from 'gxd-file-preview';

//初始化自定义插件，（pdf.js,worker.js文件建议放在本地服务器),cdn有可能不稳定
Vue.use(vueFilePreview,{
    pdf: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.0.288/build/pdf.min.js', //pdf插件
    worker:'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.0.288/build/pdf.worker.min.js',//pdf.work插件
});

Vue.prototype.util = util;
Vue.prototype.maipBridge = maipBridge;
Vue.prototype.moaBridge_ha_djfupt = moaBridge_ha_djfupt;
Vue.prototype.$moment = moment;
import VueBus from 'vue-bus';
// import ProcessNext from "@/components/ProcessNext";
// Vue.component("process-next", ProcessNext);
import VueWechatTitle from "vue-wechat-title";
Vue.use(VueWechatTitle);


Vue.use(Vant);
Vue.use(VueBus);
Vue.use(ElementUI);
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

//解决在谷歌浏览器中变量值显示省略号的问题
Vue.prototype.print = (obj, type) => {
  type = type || "log";
  const log = JSON.parse(JSON.stringify(obj));
  console[type](log);
};